package com.school.repair.service;

import com.school.repair.dao.AdminDao;
import com.school.repair.entity.Admin;
import com.school.repair.util.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class AdminService {
    @Resource
    AdminDao adminDao;
    public Admin login(String username, String password) {
            return adminDao.login(username,password);
    }

    public Admin findById(Long id) {
            return adminDao.findById(id);
    }

    public Admin adminVerification(long id, String pass) {
            return adminDao.adminVerification(id, pass);
    }

    public int updatePass(long id, String pass) {
            return adminDao.updatePass(id, pass);
    }

    public int updateData(long id, String name, String tele) {
            return adminDao.updateData(id, name, tele);
    }

    public Page<Admin> adminList(int pageNo, int pageSize, String username, String tele) {
            List<Admin> list = adminDao.adminList(pageNo, pageSize, username, tele);
            int total = adminDao.adminListTotal(username, tele);
            return new Page<Admin>(total, list, pageNo);
    }

    public int checking(String username) {
        return adminDao.checking(username);
    }

    public int adminAdd(Admin admin) {
        return adminDao.adminAdd(admin);
    }

    public int delAdmin(long id) {
        return adminDao.delAdmin(id);
    }
}
